//
// Created by Jisam on 2024/8/16 18:39.
//
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n = 40;
    vector<int> a(n);
    for(int i = 0 ; i < n; i ++){
        cin >> a[i];
    }
    long long  ans = 0;
    for(int i = 1  ; i < n ; i ++){
        long long  sum1 = accumulate(a.begin(),a.begin() + i,0);
        long long  sum2 = accumulate(a.begin() + i,a.end(),0);
        cout << sum1 << " " << sum2 <<" \n";
        ans = max(ans,sum1 * sum2* 1LL);
    }
    cout << ans;


    return 0;
}